package org.jfk.core.utils;

import java.util.Map;

import net.sf.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

public class JsonUtil {
	/**
	 * 
	 * 函数名称: parseData 函数描述: 将json字符串转换为map
	 * 
	 * @param data
	 * @return
	 */
	public static Map<String, String> jsonToMap(String data) {
		GsonBuilder gb = new GsonBuilder();
		Gson g = gb.create();
		Map<String, String> map = g.fromJson(data,
				new TypeToken<Map<String, Map>>() {
				}.getType());
		return map;
	}
	

	
	
	public static void main(String[] args){
		GsonBuilder gb = new GsonBuilder();
		Gson g = gb.create();
		String json = "{\"type\":\"Circle\",\"detail\":{\"center\":[22.82207380354523,113.87775421142578],\"radius\":5762.32343308803}}";
		
		JSONObject j = new JSONObject();
		System.out.println(JSONObject.fromObject(json).getJSONObject("detail"));
		
	}
}
